#ifndef AUDIO_VIDEO_AUTOMATION_H
#define AUDIO_VIDEO_AUTOMATION_H

#include <QObject>

class IF_MediaEngineInterface;
class MediaListModel;
class QModelIndex;
class AudioVideoSource;
class ActionListController;
class Fader;
class ApplicationSettings;


class AudioVideoAutomation : public QObject
{
   Q_OBJECT
public:
   explicit AudioVideoAutomation( IF_MediaEngineInterface *engine,  MediaListModel *model,
                                  ActionListController *controller, Fader *fader,
                                  ApplicationSettings & applicationsettigns, QObject *parent = 0);

public slots:
   void activateByRowNumer( int activeRow);
   void activateById( const QString & stringId, bool playImmediately);
   void toggleFader();
   void onClosing();

   void applyDefaultVolume();

   void defineDefaultVolume( int volume) {
      m_defaultVolume = volume;
   }

public:
   int defaultVolume() {
      return m_defaultVolume;
   }

private slots:
   void onTrackFinished();

private:
   void applyMediaSource(const AudioVideoSource *audioSource);

private:
   IF_MediaEngineInterface *m_engine;
   MediaListModel *m_model;
   ActionListController *m_controller;
   Fader *m_fader;
   const AudioVideoSource *m_currentSource;

   int m_defaultVolume;  /** a preferred volume level to be set when no fading occurs */
   ApplicationSettings & m_applicationsettigns;
};

#endif // AUDIO_VIDEO_AUTOMATION_H
